<?php

	$userID=GetLoginUserID();
	
	if($userID===false)
	{
		edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
	}
		
	$userDAO=GetUserDAO();
	$userCoins=$userDAO->GetCoinByUid($userID);
	
	if($userCoins===-1)
	{
		edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
	}
	
	require_once ( LIB_DIR.'classes/Pager.php' );
	$p=intval($_GET[UP_RESULT_PAGE]);
	$p = $p == 0 ? 1 : $p;
	
	$type=intval($_GET['type']);
	$type = $type == 0 ? 0 : 1;	
	
	$conponGiftDAO=GetGiftCouponDAO();
	$historyCount=$conponGiftDAO->GetConsumptionCountByUid( $userID, $type );
	$histories=$conponGiftDAO->GetConsumptionByUid( $userID, $type, $p, 20 );
	
	$hotCoupons=$conponGiftDAO->GetHotCoupon(10);
	$hotGifts=$conponGiftDAO->GetHotGifts(10);
	
	$pageObj = new Pager( edp_href_link(PAGENAME_CONSUMPTION_HISTORY, 'type='.$type), $historyCount, 20, $p, UP_RESULT_PAGE );
	
	return true;
	
?>